var AllIndex = function() {

}

AllIndex.prototype.IndexInit = function() {
	var that = this;
	that.AindexVu();
}

AllIndex.prototype.AindexVu = function() {
	var that = this;
	var m_vu = new Vue({
		el: '#back_Vu',
		data: {
			isCollapse: true,
			editableTabsValue: '1',
			editableTabs: [{
				title: 'Tab 1',
				name: '1',
				content: '<iframe src="uploadFile.html"></iframe>'
			}, {
				title: 'Tab 2',
				name: '2',
				content: '<iframe src=""></iframe>'
			}],
			tabIndex: 2
		},
		methods: {
			dockerPage:function () {

			},
			handleOpen: function(key, keyPath) {

			},
			checkMenu: function(key, keyPath) {
				switch(key) {
					case "gz":
						var sml = {
							title: '表格处理',
							name: 'bgcl',
							content: '<iframe src="execlController.html"></iframe>'
						}
						this.editableTabs.push(sml);
						break;
					case "gn":
						break;
					default:
						break;
				}
			},
			handleClose: function(key, keyPath) {
				console.log(key, keyPath);
			},
			addTab: function(targetName,tabpage) {
				let newTabName = ++this.tabIndex + '';
				this.editableTabs.push({
					title: targetName,
					name: newTabName,
					content: '<iframe src="'+tabpage+'.html"></iframe>'
				});
				this.editableTabsValue = newTabName;
			},
			removeTab: function(targetName) {
				let tabs = this.editableTabs;
				let activeName = this.editableTabsValue;
				if(activeName === targetName) {
					tabs.forEach((tab, index) => {
						if(tab.name === targetName) {
							let nextTab = tabs[index + 1] || tabs[index - 1];
							if(nextTab) {
								activeName = nextTab.name;
							}
						}
					});
				}
				this.editableTabsValue = activeName;
				this.editableTabs = tabs.filter(tab => tab.name !== targetName);
			}
		}
	})
}